//
//  DaletouNumber.m
//  PlayBall
//
//  Created by Huawen Liu on 12-6-11.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddDaletouNumber.h"

@implementation JddDaletouNumber

@synthesize headBallArray;
@synthesize backBallArray;

- (id)init{
    self = [super init];
    
    if (self) {
        self.headBallArray = [NSMutableArray array];
        self.backBallArray = [NSMutableArray array];
    }
    
    return self;
}

- (NSInteger)addheadBallNumber:(NSInteger)number{
    [headBallArray addObject:[NSNumber numberWithInt:number]];
    
    return [headBallArray count];
}

- (NSInteger)addbackBallNumber:(NSInteger)number{
    [backBallArray addObject:[NSNumber numberWithInt:number]];
    
    return [backBallArray count];
}

- (NSInteger)removeheadBallNumber:(NSInteger)number{
    for (NSNumber *inNumber in headBallArray) {
        if ([inNumber intValue] == number) {
            [headBallArray removeObject:inNumber];
            break;
        }
    }
    
    return [headBallArray count];
}

- (NSInteger)removebackBallNumber:(NSInteger)number{
    for (NSNumber *inNumber in backBallArray) {
        if ([inNumber intValue] == number) {
            [backBallArray removeObject:inNumber];
            break;
        }
    }
    
    return [backBallArray count];
}

- (void)clear{
    [headBallArray removeAllObjects];
    [backBallArray removeAllObjects];
}

- (void)clearheadBallNumber{
    [headBallArray removeAllObjects];
}

- (void)clearbackBallNumber{
    [backBallArray removeAllObjects];
}

- (BOOL)headBallHasNumber:(NSInteger)number{
    for (NSNumber *inNumber in headBallArray) {
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;	
}

- (BOOL)backBallHasNumber:(NSInteger)number{
    for (NSNumber *inNumber in backBallArray) {
        if ([inNumber intValue] == number) {
            return YES;
        }
    }
    
    return NO;
}



@end
